﻿namespace EyeOpen.ViewModel
{
    public partial class UserViewModel : ViewModelBase
    {
        private bool isBusy;
        private string user;
        private string password;
        private bool isLoggedIn;
        private string introductoryText;
        private string errorText;

        /// <summary>
        /// Returns true if the application is busy.
        /// </summary>
        public bool IsBusy
        {
            get
            {
                return isBusy;
            }

            set
            {
                isBusy = value;
                OnPropertyChanged("IsBusy");
            }
        }

        public string User
        {
            get
            {
                return user;
            }

            set
            {
                user = value;
                OnPropertyChanged("OkButtonIsEnabled");
                OnPropertyChanged("User");
            }
        }

        public string Password
        {
            get
            {
                return password;
            }

            set
            {
                password = value;
                OnPropertyChanged("OkButtonIsEnabled");
                OnPropertyChanged("Password");
            }
        }

        public bool IsLoggedIn
        {
            get
            {
                return isLoggedIn;
            }

            set
            {
                isLoggedIn = value;
                OnPropertyChanged("IsLoggedIn");
            }
        }

        public string IntroductoryText
        {
            get
            {
                return introductoryText;
            }

            set
            {
                introductoryText = value;
                OnPropertyChanged("IntroductoryText");
            }
        }

        public string ErrorText
        {
            get
            {
                return errorText;
            }

            set
            {
                errorText = value;
                OnPropertyChanged("ErrorText");
            }
        }

        public bool OkButtonIsEnabled
        {
            get
            {
                return !string.IsNullOrWhiteSpace(User) && !string.IsNullOrWhiteSpace(Password);
            }

            set
            {
                OnPropertyChanged("OkButtonIsEnabled");
            }
        }
    }
}
